PR/DynamoDB operations and parsers#1521
Conversation
|
Why don't you dump the dynamoDB query into a string and then parse it back from it? |
… to verify BETWEEN works with byte bounds (also ran an integration test but it's beyond the scope of this commit and will add as part of end 2 end tests later. Renamed all "Object request" to ddbRequest to make it easier to read. Improved Javadoc all around.
Check latest commit with comments added. |
|
Please remember to re-ask for a review. Otherwise it might miss to review your changes. |
|
@jgaleotti @aschenzle sorry, due to exams and sickness, don't think i ll have any time to look at this till next week |
| public Map<String, QueryOperation> parseRequest(Object ddbRequest) { | ||
| Object requestItemsObj = invokeNoArg(ddbRequest, METHOD_REQUEST_ITEMS); | ||
| if (!(requestItemsObj instanceof Map<?, ?>)) { | ||
| return Collections.emptyMap(); |
There was a problem hiding this comment.
are there cases in which this is a normal behavior?
or should rather throw an exception? or issue a warning?
i mean, what are the cases in which METHOD_REQUEST_ITEMS does not return a map?
or should explicitly as well check for null?
There was a problem hiding this comment.
Hi @arcuri82 no, it's not expected (it's either a map or null at most), the design decision here is around allowing the program to continue with less information (given that DDB is a secondary target) vs throwing and catching exceptions upstream which could potentially (if not well managed) stop the whole test generation. Let me know if you strongly prefer Exceptions instead.
There was a problem hiding this comment.
not throwing exception is fine, but silently ignoring the problem is not. you can use SimpleLogger to log this issue
Introduces DynamoDB operations and parsers. The design differ a little bit from Mongo and other DBs as DynamoDB has complex expression that need to be parsed in order of precedence. There are top level parsers instead of simple selectors and the logic is split per Dynamo API call and some helper classes. To avoid writing a full blown parser I'm using Antlr as a runtime dependency in controller, I shaded the dependency but please let me know if this could bring any problems or if I'm missing something.
Some random comments: 1) Netty dependency is no longer explicitly needed in controller as now AWSSDK is bringing it. 2) There's a fix for hibernate-validator dependency which is unrelated but eliminates some warnings. 3) Added SimpleLogger to controller tests, eliminates a warning when running tests and actually logs (for example I could see the whole Docker log which wasn't visible before), this will probably increase the warning count when running tests, this is just surfacing them.